<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:spring="http://www.springframework.org/tags"
	xmlns:form="http://www.springframework.org/tags/form" version="2.0">
	<jsp:directive.page contentType="text/html; charset=UTF-8"
		pageEncoding="UTF-8" session="true" />
	<jsp:output doctype-root-element="html"
		doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
		omit-xml-declaration="true" />
	<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><spring:message code="page.newBooking.title" /></title>
<c:url value="/resources/css/jquery.datetimepicker.css"
	var="datatimepeackerCssUrl" />
<link rel="stylesheet" type="text/css" href="${datatimepeackerCssUrl}" />
</head>
<body>
	<c:import url="header.jsp" />

	<c:url value="/customer/newBooking/add" var="addBookingUrl"></c:url>

	<div>
		<form:form action="${addBookingUrl}" method="post"
			commandName='bookingItemForm'>
			<table border="0">
				<tr>
					<td><spring:message code="customerpage.booking.issuePlace" />
						:</td>
					<td><form:input path="issuePlace"></form:input></td>
					<td><form:errors path="issuePlace" cssclass="error"></form:errors></td>
				</tr>
				<tr>
					<td><spring:message code="customerpage.booking.returnPlace" />
						:</td>
					<td><form:input path="returnPlace"></form:input></td>
					<td><form:errors path="returnPlace" cssclass="error"></form:errors></td>
				</tr>
				<tr>
					<td><spring:message code="customerpage.booking.issueDate" />
						:</td>
					<td><form:input path="issueDate"></form:input></td>
					<td><form:errors path="issueDate" cssclass="error"></form:errors></td>
				</tr>
				<tr>
					<td><spring:message code="customerpage.booking.returnDate" />
						:</td>
					<td><form:input path="returnDate"></form:input></td>
					<td><form:errors path="returnDate" cssclass="error"></form:errors></td>
				</tr>

				<tr>
					<td><spring:message code="customerpage.booking.carModel" /> :
					</td>
					<td><form:select path="car">
							<c:if test="${carList ne null}">
								<c:forEach items="${carList}" var="car">
									<c:if test="${carId ne null}">
										<c:choose>
											<c:when test="${carId == car.carId}">
												<form:option selected="selected" value="${car.carId}">
													<c:out value="${car.model}"></c:out>
												</form:option>
											</c:when>

											<c:otherwise>
												<form:option value="${car.carId}">
													<c:out value="${car.model}"></c:out>
												</form:option>
											</c:otherwise>
										</c:choose>
									</c:if>
									<c:if test="${carId eq null}">
										<form:option value="${car.carId}">
											<c:out value="${car.model}"></c:out>
										</form:option>
									</c:if>
								</c:forEach>
							</c:if>
						</form:select></td>
				</tr>

				<tr>
					<td><spring:message code="customerpage.booking.insurance" />:
					</td>
					<td><form:select path="insurance">
							<c:if test="${insuranceList ne null}">
								<c:forEach items="${insuranceList}" var="insurance">
									<form:option value="${insurance.insuranceId }">
										<c:out value="${insurance.name}"></c:out>
									</form:option>
								</c:forEach>
							</c:if>
						</form:select></td>
				</tr>

				<tr>
					<td><spring:message code="customerpage.booking"
							var="bookingBut" /> <input type="submit" value="${bookingBut}" />
					</td>
				</tr>
			</table>
		</form:form>
	</div>
	<!-- 	<h3>DateTimePicker</h3> -->
	<!-- 	<input type="text" value="" id="datetimepicker" /> -->
	<!-- 	<br /> -->

	<br />
	<br />
	<br />
	<c:url value="/customer" var="backRef" />

	<a href="${backRef}"><spring:message
			code="customerpage.paymant.back" /></a>


	<!-- 	<c:url value="/resources/js/jquery-1.11.1.min.js" var="jqueryJs" /> -->

	<!-- <script type="text/javascript" src="${jqueryJs}"></script> -->
	<c:url value="/resources/js/jquery.datetimepicker.js" var="datatimeJs" />

	<script type="text/javascript" src="${datatimeJs}"></script>


	<script>
		$('#datetimepicker').datetimepicker({
			dayOfWeekStart : 1,
			lang : 'ru',
			startDate : '1986/01/05'
		});
	</script>
</body>
	</html>
</jsp:root>
